import Vue from 'vue'
import App from './App'
import Json from './static/Json' //测试用数据
import {http} from './http.js' //测试用数据
import uView from "uview-ui";
import uniPopup from '@/components/uni-popup/uni-popup.vue'
import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
import nodate from '@/components/nodata.vue'
Vue.config.productionTip = false
Vue.component('popup',uniPopup)
Vue.component('nodate',nodate)
Vue.component('msg',uniPopupMessage)
Vue.component('dialog',uniPopupDialog)
Vue.use(uView);
const json = type=>{
	return Json[type]
	// //模拟异步请求数据
	// return new Promise(resolve=>{
	// 	setTimeout(()=>{
	// 		resolve(Json[type]);
	// 	}, 500)
	// })
}
const msg = (title, duration=1500, mask=false, icon='none')=>{
	//统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}
App.mpType = 'app'
Vue.prototype.$api = {msg, json};
Vue.prototype.$http = http
const app = new Vue({
    ...App
})
app.$mount()
